package com.ng.desktop.view.alimento;

import java.awt.Dimension;
import java.util.Arrays;
import java.util.List;

import com.ng.desktop.model.Alimento;
import com.ng.desktop.persistence.AlimentoPersistence;
import com.ng.desktop.services.NGFactoryBean;
import com.ng.framework.persistence.NGSearchParameter.Type;
import com.ng.framework.persistence.NGSearchParameter.UnaryOperation;
import com.ng.framework.view.desktop.NGABMCFrame;
import com.ng.framework.view.desktop.NGGUIUtils;
import com.ng.framework.view.desktop.NGTablePanel;
import com.ng.framework.view.desktop.filters.NGFilter;
import com.ng.framework.view.desktop.filters.NGTextFieldFilter;


public class AlimentoFrame extends NGABMCFrame<Alimento, AlimentoPersistence> {

	private static final long serialVersionUID = -4582051075258524335L;
	
	public AlimentoFrame() {
		this.setFrameIcon(NGGUIUtils.getImageIcon("icons/cheese.png"));
		this.setTitle("Gestión de Alimentos");
		this.setSize(new Dimension(600, 600));
		this.centrar();
	}

	@Override
	protected AlimentoPersistence createPersistence() {
		return (AlimentoPersistence) NGFactoryBean.getInstance().getBean("alimentoPersistence");
	}

	@Override
	protected List<NGFilter> createFilters() {
		return Arrays.asList(new NGFilter[] { new NGTextFieldFilter("Nombre", Alimento.class, "nombre", Type.STRING, UnaryOperation.LIKE) });
	}

	@Override
	protected NGTablePanel<Alimento, AlimentoPersistence> createTable(
			AlimentoPersistence persistence) {
		return new AlimentoTablePanel(persistence);
	}



}
